﻿
namespace Huirui.Cavan.Presentation.Seedwork
{
    using System;
    using System.Collections.Generic;
    using System.Diagnostics.Contracts;
    using System.Linq;
    using Huirui.Cavan.Core.Persistent;
    using Huirui.Cavan.Application.Seedwork;

    /// <summary>
    ///     IEntityController is intended mostly for the AOP filters.
    ///     It provides the common interface to every 'Entity' controller with 'Entity' model.
    ///     AOP then can append or remove some needed values (e.g. due to Access Rights).
    /// 
    ///     This interface is the same for the Read controllers and Reade-Write == EntityControllers.
    ///     The reason is, that the IEntityModel is the same for both - and only relevant.
    ///     Write actions are out of the AOP Filters interest (they can be disabled before they are rised)
    /// </summary>
    public interface IEntityController<out TModel,out TAppService> : IWebController<TModel>
        where TModel : class, IEntityModel<IPersistentObject, ISearch>
        where TAppService : class, IAppService
    {
        /// <summary>
        ///     Every Entity Controller is expected to have its own IFacade instance
        ///     for getting resp. setting the Entity from/into data-storage.
        ///     Provides the Dependency Injection setter. 
        ///     It could be 'overrided' to expect more specific type e.g. IEntityFacade&lt;T, TID&gt;.
        /// </summary>
        TAppService AppService { get; }
    }
}